package com.cnebula.openapi.auth.exception;

import java.util.ArrayList;
import java.util.List;

public class ErrorInfoTable {

	private static List<String> errorInfos400 = new ArrayList<String>();
	private static List<String> errorInfos500 = new ArrayList<String>();
	
	private static List<String> errorInfos = new ArrayList<String>();
	
	static {
		init400();
		init500();
		
		errorInfos.addAll(errorInfos400);
		errorInfos.addAll(errorInfos500);
	}
	
	private static void init400() {
		errorInfos400.add(HeaderParamsMissing.class.getName());
		errorInfos400.add(RequestParamsMissing.class.getName());
	}
	
	private static void init500() {
		errorInfos500.add(AccessTokenNotFoundException.class.getName());
		errorInfos500.add(AccessTokenIllegalException.class.getName());
		errorInfos500.add(AuthCodeUnavailableException.class.getName());
		errorInfos500.add(ClientAppAddressMismatch.class.getName());
		errorInfos500.add(ClientAppServiceRequestFail.class.getName());
		errorInfos500.add(ClientKeyExpireException.class.getName());
		errorInfos500.add(ClientKeyNoExistException.class.getName());
		errorInfos500.add(ClientKeyUnavailableExceptoin.class.getName());
		errorInfos500.add(OAuthResponseTypeUnsupported.class.getName());
		errorInfos500.add(OAuthGrantTypeUnsupported.class.getName());
		errorInfos500.add(OAuthRedirectURIMismatch.class.getName());
		errorInfos500.add(SignExpireException.class.getName());
		errorInfos500.add(SignIllegalException.class.getName());
	}
	
	public static boolean isErrorInfos400(String clsName) {
		return errorInfos400.contains(clsName);
	}
	
	public static boolean isErrorInfos500(String clsName) {
		return errorInfos500.contains(clsName);
	}
	
	public static boolean isErrorInfos(String clsName) {
		return errorInfos.contains(clsName);
	}
	
}
